<template>
	<el-card shadow="hover">
		<template v-slot:header>
			会议纪要
			<div style="float: right;display: inline-flex;color: #FFFFFF;">
				<sc-icon style="cursor: pointer;width: 18px; margin-right: 10px;" @click="reLoadMeetingNotes" title="刷新"><el-icon-refresh-right/></sc-icon>
				<sc-icon style="cursor: pointer;width: 18px;" @click="getMoreMeetingNotes" title="全部"><el-icon-more-filled/></sc-icon>
			</div>
		</template>
		<div style="height: 210px;text-align: center;">
			<el-table :data="meetingNotesList" style="width: 100%;cursor: pointer" :show-header="false" @row-click="showMeetingNotesDetails" class="customer-table">
				<el-table-column prop="createUserName" width="120">
					<template #default="scope">
						<div style="position: relative;height: 23px">
							<el-avatar :src="scope.row.avatar" size="small"></el-avatar>
							<span style="position: absolute;margin-left: 10px;">
								{{scope.row.createUserName}}
							</span>
						</div>
					</template>
				</el-table-column>
				<el-table-column prop="notesTitle" :show-overflow-tooltip="true">
					<template #default="scope">
						{{scope.row.notesTitle}}
					</template>
				</el-table-column>
				<el-table-column prop="beginTime" width="180" align="center">
					<template #default="scope">
							{{scope.row.createTime}}
					</template>
				</el-table-column>
			</el-table>
		</div>
	</el-card>
	<notes-details v-if="dialog.save" ref="detailsDialog"  @closed="dialog.save=false"></notes-details>
</template>

<script>
import NotesDetails from "@/views/office/meeting/notes/notesDetails";
export default {
	name: 'My Meeting Notes',
	components: {
		NotesDetails,
	},
	data() {
		return {
			dialog: {
				save: false
			},
			meetingNotesList:[],
			timer:null
		}
	},
	created() {
		clearInterval(this.timer)
		this.timer = null
	},
	beforeUnmount() {
		clearInterval(this.timer);
		this.timer = null
	},
	mounted() {
		this.getMyMeetingNotesListForDesk();
		this.setTimer();
	},
	methods: {
		reLoadMeetingNotes(){
			this.getMyMeetingNotesListForDesk();
		},
		getMoreMeetingNotes(){
			this.$nextTick(() => {
				this.$router.replace({
					path: '/office/meeting/notes/search',
				})
			})
		},
		async getMyMeetingNotesListForDesk(){
			var res = await this.$API.office.meeting.getMyMeetingNotesListForDesk.get();
			if (res.code == 200) {
				this.meetingNotesList = res.data
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		showMeetingNotesDetails(row, event, column) {
			this.dialog.save = true
			this.$nextTick(() => {
				this.$refs.detailsDialog.open().setData(row)
			})
		},
		setTimer() {
			if(this.timer == null) {
				this.timer = setInterval( () => {
					this.getMyMeetingNotesListForDesk();
				}, this.$TOOL.data.get("MSG_TIME"))
			}
		}
	}
}
</script>
<style scoped>
:deep(.el-card__header){
	background: rgba(64, 158, 255, 0.6);
	color: white;
	padding: 10px 20px 10px 20px;
}
:deep(.el-table tr){
	cursor: pointer;
}
.customer-table th {
	border: none;
}

.customer-table td, .customer-table th.is-leaf {
	border: none;
}

.el-table--border, .el-table--group {
	border: none;
}

.customer-table thead tr th.is-leaf {
	border: 1px solid #EBEEF5;
	border-right: none;
}

.customer-table thead tr th:nth-last-of-type(2) {
	border-right: 1px solid #EBEEF5;
}

.el-table--border::after, .el-table--group::after {
	width: 0;
}

.customer-table::before {
	width: 0;
}

.customer-table .el-table__fixed-right::before, .el-table__fixed::before {
	width: 0;
}

.el-table--border th.gutter:last-of-type {
	border: 1px solid #EBEEF5;
	border-left: none;
}
</style>
